package com.wbl.tijiancms.controller;

import com.wbl.tijiancms.pojo.Cidetailedreport;
import com.wbl.tijiancms.pojo.Cireport;
import com.wbl.tijiancms.pojo.Orders;
import com.wbl.tijiancms.response.ApiRestResponse;
import com.wbl.tijiancms.service.CidetailedreportService;
import com.wbl.tijiancms.service.CireportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/report")
@RestController
public class ReportController {

    @Autowired
    CidetailedreportService cidetailedreportService;

    @Autowired
    CireportService cireportService;

    @ResponseBody
    @PostMapping("/createCireport")
    public ApiRestResponse createCireport(@RequestBody Orders orders) throws Exception {
        return cireportService.createCireport(orders);
    }

    @ResponseBody
    @PostMapping("/createDetailed")
    public ApiRestResponse createDetailed(@RequestBody List<Cidetailedreport> cidetailedreports) throws Exception {

        return cidetailedreportService.createDetailed(cidetailedreports);
    }

    @ResponseBody
    @PostMapping("/getReportList")
    public ApiRestResponse getReportList(@RequestBody Orders orders) throws Exception {
        return cireportService.getReportList(orders);
    }

    @ResponseBody
    @PutMapping("/editValue")
    public ApiRestResponse editValue(@RequestBody List<Cidetailedreport> cidetailedreports) throws Exception {
        return cireportService.editValue(cidetailedreports);
    }
}
